<script>
function delay(ms) {
  return new Promise((resolve, reject) => {
    setTimeout(resolve, ms)
  })
}
const p1 = delay(1000).then(() => {throw 1})
const p2 = delay(2000).then(() => {throw '❌'})
const p3 = delay(1500).then(() => {throw 3})
const p4 = delay(500).then(() => {throw 4})

const p = Promise.any([p1, p2, p3, p4])
const begin = Date.now()
p.then(
  (v) => console.log(v, Date.now() - begin),
  (e) => console.log(e.errors, Date.now() - begin)
)
</script>